<%@ Page Title="Menu Form" Language="C#" AutoEventWireup="true" CodeFile="stpReason_Form.aspx.cs"
    Inherits="RTGS.Web.form.rtgs.stpReason_Form" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Role Form</title>
    <link href="<%= ResolveClientUrl("~/css/validationEngine.jquery.css") %>" rel="stylesheet"
        type="text/css" />
    <script src="<%= ResolveClientUrl("~/script/helper.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveClientUrl("~/script/jquery.validationEngine.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveClientUrl("~/script/autoNumeric-1.7.5.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveClientUrl("~/script/languages/jquery.validationEngine-en.js") %>"
        type="text/javascript"></script>
    
    
    <script type="text/javascript" language="javascript">

        jQuery(document).ready(function () {
            // binds form submission and fields to the validation engine
            jQuery(".form1").validationEngine();
            if ($(".form1").validationEngine('validate')) { }
            else jQuery(".form1").submit();


        });

        $(function () {
            $('#save').click(function () {
                if ($(".form1").validationEngine('validate')) {

                    var reasonid = encodeURIComponent($('#<%=txtreasonid.ClientID %>').val());
                    var reasondesc = encodeURIComponent($('#<%=txtreasondesc.ClientID %>').val());


                    var param = '&reasonid=' + reasonid + '&reasondesc=' + reasondesc;

                    var id = $('#<%= hfID.ClientID %>').val();
                    if (id == 0)
                        CallAjax("../../Ajaxhandler/rtgs/stp_Reason.ashx", "?method=insert&" + param);
                    else
                        CallAjax("../../Ajaxhandler/rtgs/stp_Reason.ashx", "?method=update&" + param + "&id=" + id);
                    parent.$("#dialog").dialog("close");


                    setTimeout("parent.$('#table').trigger('reloadGrid');", 3000);
                }
                return false;
            });
        });


        function ClearText() {

            $('#<%=txtreasonid.ClientID %>').val('');
            $('#<%=txtreasondesc.ClientID %>').val('');
        }
    </script>
</head>
<body onload="ClearText();">
    <form id="form1" runat="server">
    <table border="0">
        <tr>
            <td>
                Reason Code
            </td>
            <td>
                :
            </td>
            <td>
                <asp:TextBox ID="txtreasonid" MaxLength="10" runat="server" Width="200" CssClass="validate[required]"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>
                Reason Desc.
            </td>
            <td>
                :
            </td>
            <td>
                <asp:TextBox ID="txtreasondesc" MaxLength="50" runat="server" Width="300" CssClass="validate[required]"></asp:TextBox>
            </td>
        </tr>
    </table>
    <asp:HiddenField ID="hfID" runat="server" />
    <br />
    <div class="butForm">
        <a href="javascript:void(0);" id="save" class="dialog_link ui-state-default ui-corner-all"
            title="Save"><span class="ui-icon ui-icon-disk"></span>Save</a> <a href="javascript:void(0);"
                id="close" class="dialog_link ui-state-default ui-corner-all" title="Close" onclick="parent.$('#dialog').dialog('close');">
                <span class="ui-icon ui-icon-close"></span>Cancel</a>
    </div>
    </form>
</body>
</html>
